import java.util.Scanner;

//题目：打印出杨辉三角形
public class Test33 {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.println("请输入打印行数：");
        int n = console.nextInt();
        int[][] arr = new int[n][];//存储杨辉三角数值
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new int[i + 1];
        }
        //设置杨辉三角数值
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                arr[i][0] = arr[i][i] = 1;
                if (i > 1 && j > 0 && j < i) {
                    arr[i][j] = arr[i - 1][j] + arr[i - 1][j - 1];
                }
            }
        }
        //输出杨辉三角
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j]);
                System.out.print('\t');
            }
            System.out.println();
        }
    }
}
